package com.Priority;

import java.util.concurrent.FutureTask;
//线程优先级的范围为1-10；默认情况下为5
public class Demo {
    public static void main(String[] args) {
        MyCallable myCallable = new MyCallable();
        FutureTask<String> stringFutureTask = new FutureTask<String>(myCallable);
        Thread thread = new Thread(stringFutureTask);
//        设置优先级
        thread.setPriority(10);
//          获取当前线程的优先级
        int priority = thread.getPriority();
        System.out.println("priority = " + priority);
        thread.start();


        MyCallable myCallable2 = new MyCallable();
        FutureTask<String> stringFutureTask2 = new FutureTask<String>(myCallable2);
        Thread thread2 = new Thread(stringFutureTask2);
        int priority1 = thread2.getPriority();
        System.out.println("priority1 = " + priority1);
        thread2.start();

    }
}
